.class public Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;
.super Ljava/lang/Object;
.source "ViewSearch.java"

# interfaces
.implements Lcom/glympse/platform/common/SearchResultsListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/glympse/android/glympse/ViewSearch;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1
    name = "OnSearchCompleted"
.end annotation


# instance fields
.field final synthetic this$0:Lcom/glympse/android/glympse/ViewSearch;


# direct methods
.method public constructor <init>(Lcom/glympse/android/glympse/ViewSearch;)V
    .locals 0
    .parameter

    .prologue
    .line 284
    iput-object p1, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public Complete(Lcom/glympse/platform/GVector$SearchResults;)V
    .locals 12
    .parameter

    .prologue
    .local p1, listSearchResults:Lcom/glympse/platform/GVector$SearchResults;,"Lcom/glympse/platform/GVector$SearchResults;"
    const/4 v11, 0x1

    const/4 v10, 0x0

    .line 290
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0}, Lcom/glympse/android/glympse/ViewSearch;->access$12(Lcom/glympse/android/glympse/ViewSearch;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 293
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0}, Lcom/glympse/android/glympse/ViewSearch;->access$0(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/AutoCompleteTextView;

    move-result-object v0

    invoke-virtual {v0}, Landroid/widget/AutoCompleteTextView;->getText()Landroid/text/Editable;

    move-result-object v0

    invoke-interface {v0}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v9

    .line 294
    .local v9, strTitle:Ljava/lang/String;
    invoke-virtual {p1}, Lcom/glympse/platform/GVector$SearchResults;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-nez v1, :cond_2

    .line 301
    .end local v9           #strTitle:Ljava/lang/String;
    :cond_0
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0}, Lcom/glympse/android/glympse/ViewSearch;->access$12(Lcom/glympse/android/glympse/ViewSearch;)Z

    move-result v0

    if-eqz v0, :cond_3

    invoke-virtual {p1}, Lcom/glympse/platform/GVector$SearchResults;->size()I

    move-result v0

    if-ne v11, v0, :cond_3

    .line 303
    sget-object v0, Lcom/glympse/android/glympse/Glympse$EViews;->Destination:Lcom/glympse/android/glympse/Glympse$EViews;

    sget-object v1, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    invoke-virtual {v1}, Lcom/glympse/android/glympse/Glympse;->GetCurrentEView()Lcom/glympse/android/glympse/Glympse$EViews;

    move-result-object v1

    if-eq v0, v1, :cond_1

    .line 305
    invoke-virtual {p1, v10}, Lcom/glympse/platform/GVector$SearchResults;->get(I)Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Lcom/glympse/platform/common/SearchResult;

    .line 306
    .local v7, oSearchResult:Lcom/glympse/platform/common/SearchResult;
    sget-object v0, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    iget-object v0, v0, Lcom/glympse/android/glympse/Glympse;->m_oViewDestination:Lcom/glympse/android/glympse/ViewDestination;

    .line 307
    iget-object v1, v7, Lcom/glympse/platform/common/SearchResult;->m_strTitle:Ljava/lang/String;

    .line 308
    iget-wide v2, v7, Lcom/glympse/platform/common/SearchResult;->m_dLatitude:D

    .line 309
    iget-wide v4, v7, Lcom/glympse/platform/common/SearchResult;->m_dLongitude:D

    .line 306
    invoke-virtual/range {v0 .. v5}, Lcom/glympse/android/glympse/ViewDestination;->SetDestination(Ljava/lang/String;DD)V

    .line 310
    sget-object v0, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    sget-object v1, Lcom/glympse/android/glympse/Glympse$EViews;->Destination:Lcom/glympse/android/glympse/Glympse$EViews;

    sget-object v2, Lcom/glympse/android/glympse/Glympse$EAnimations;->SlideLeft:Lcom/glympse/android/glympse/Glympse$EAnimations;

    sget-object v3, Lcom/glympse/android/glympse/Glympse$EAnimations;->SlideRight:Lcom/glympse/android/glympse/Glympse$EAnimations;

    invoke-virtual {v0, v1, v2, v3}, Lcom/glympse/android/glympse/Glympse;->PushView(Lcom/glympse/android/glympse/Glympse$EViews;Lcom/glympse/android/glympse/Glympse$EAnimations;Lcom/glympse/android/glympse/Glympse$EAnimations;)Lcom/glympse/android/glympse/Glympse$EViews;

    .line 323
    .end local v7           #oSearchResult:Lcom/glympse/platform/common/SearchResult;
    :cond_1
    :goto_1
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0, v10}, Lcom/glympse/android/glympse/ViewSearch;->access$13(Lcom/glympse/android/glympse/ViewSearch;Z)V

    .line 324
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0, v10}, Lcom/glympse/android/glympse/ViewSearch;->access$14(Lcom/glympse/android/glympse/ViewSearch;Z)V

    .line 325
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0}, Lcom/glympse/android/glympse/ViewSearch;->access$0(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/AutoCompleteTextView;

    move-result-object v0

    invoke-virtual {v0, v11}, Landroid/widget/AutoCompleteTextView;->setEnabled(Z)V

    .line 326
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0}, Lcom/glympse/android/glympse/ViewSearch;->access$10(Lcom/glympse/android/glympse/ViewSearch;)V

    .line 327
    return-void

    .line 294
    .restart local v9       #strTitle:Ljava/lang/String;
    :cond_2
    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Lcom/glympse/platform/common/SearchResult;

    .line 296
    .local v6, oResult:Lcom/glympse/platform/common/SearchResult;
    iput-object v9, v6, Lcom/glympse/platform/common/SearchResult;->m_strTitle:Ljava/lang/String;

    goto :goto_0

    .line 317
    .end local v6           #oResult:Lcom/glympse/platform/common/SearchResult;
    .end local v9           #strTitle:Ljava/lang/String;
    :cond_3
    new-instance v8, Lcom/glympse/android/glympse/ViewSearch$SearchResultAdapter;

    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-virtual {v0}, Lcom/glympse/android/glympse/ViewSearch;->getContext()Landroid/content/Context;

    move-result-object v0

    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1, p1}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V

    invoke-direct {v8, v0, v1}, Lcom/glympse/android/glympse/ViewSearch$SearchResultAdapter;-><init>(Landroid/content/Context;Ljava/util/ArrayList;)V

    .line 318
    .local v8, oSearchResultAdapter:Lcom/glympse/android/glympse/ViewSearch$SearchResultAdapter;
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0}, Lcom/glympse/android/glympse/ViewSearch;->access$8(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/ListView;

    move-result-object v0

    invoke-virtual {v0, v8}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 319
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0}, Lcom/glympse/android/glympse/ViewSearch;->access$9(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/TextView;

    move-result-object v0

    const v1, 0x7f0a0049

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(I)V

    .line 320
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;->this$0:Lcom/glympse/android/glympse/ViewSearch;

    invoke-static {v0}, Lcom/glympse/android/glympse/ViewSearch;->access$8(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/ListView;

    move-result-object v0

    invoke-virtual {v0, v8}, Landroid/widget/ListView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    goto :goto_1
.end method
